
package com.showcai.controller.customer;

import com.showcai.controller.base.BaseController;
import com.showcai.service.AdminUserService;
import com.showcai.service.RoleService;
import com.showcai.service.UserService;
import com.showcai.service.UserThirdService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;
import java.util.Map;

/**
 * Created by lutao on 2017/7/14.
 */
@RequestMapping("/customer")
@Controller
public class CustomerController extends BaseController {

    @Autowired
    AdminUserService adminUserService;

    @Autowired
    UserService userService;
    @Autowired
    RoleService roleService;
    @Autowired
    UserThirdService userThirdService;



    @RequestMapping(value = "/customerList")
    public ModelAndView customerList() {
        ModelAndView mov = new ModelAndView();
        try {
            mov.addObject("pageInfo", userService.userList(super.showRequestParameters()));
            mov.setViewName("customer/customerList");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return mov;
    }
    @RequestMapping(value = "/otherAccountList")
    public ModelAndView otherAccountList() {
        ModelAndView mov = new ModelAndView();
        try {
            mov.addObject("userThirdList", userThirdService.userThirdList(super.showRequestParameters()));
            mov.setViewName("customer/otherAccountList");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return mov;
    }
    @RequestMapping(value = "/deviceList")
    public ModelAndView deviceList() {
        ModelAndView mov = new ModelAndView();
        try {
            List<Map<String,String>> mapList=userService.getDeviceByUser(super.showRequestParameters());
            mov.addObject("deviceList", mapList);
            mov.setViewName("customer/deviceList");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return mov;
    }


}
